package com.avery.imp;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.avery.dao.IProvinceDao;
import com.avery.entity.Province;

public class ProvinceDaoImp extends SqlSessionDaoSupport implements IProvinceDao {

	public void insert(Province province) {
		
		getSqlSession().insert("Province.insert", province);
		
	}

	public List<Province> getAllProvince() {
		
		List<Province> provinces = getSqlSession().selectList("Province.selectAll");
		
		return provinces;
	}

	public int getProvinceIDByName(String name) {
		
		Province province = getSqlSession().selectOne("Province.getByName",name);
		
		return province==null?-1:province.getId();
	}

}
